package com.hzqy.web.ac;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hzqy.service.broadcast.BroadcastServiceBean;
import com.hzqy.web.vo.CmContentVo;
import com.hzqy.web.vo.broadcast.CmReviewGroupVo;


@Controller
@RequestMapping("/broadcast")
public class BroadcastAction {
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	
	@Resource
	private BroadcastServiceBean broadcastServiceBean;
	
	@RequestMapping("/selectContentListByOrgId")
	@ResponseBody
	public Object selectContentListByOrgId(CmContentVo cmContentVo,int pageNo,int pageSize) {
		return broadcastServiceBean.selectContentListByOrgId(cmContentVo,pageNo,pageSize);
	}
	
	@RequestMapping("/selectContentCountByOrgId")
	@ResponseBody
	public Object selectContentCountByOrgId(CmContentVo cmContentVo) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("f_cc_companyid", cmContentVo.getF_cco_orgId());
		return broadcastServiceBean.selectContentCountByOrgId(map);
	}
	
	@RequestMapping("/updateContent")
	@ResponseBody
	public Object updateContent(CmContentVo cmContentVo) {
		Map<String, Object> map = new HashMap<String,Object>();
		int flag = broadcastServiceBean.updateContent(cmContentVo);
		if(flag > 0) {
			map.put("success", true);
		}else {
			map.put("success", false);
		}
		return map;
	}
	
	@RequestMapping("/selectContentListByOrgIdHY")
	@ResponseBody
	public Object selectContentListByOrgIdHY(CmContentVo cmContentVo,int pageNo,int pageSize) {
		return broadcastServiceBean.selectContentListByOrgIdHY(cmContentVo,pageNo,pageSize);
	}
	
	@RequestMapping("/selectContentCountByOrgIdHY")
	@ResponseBody
	public Object selectContentCountByOrgIdHY(CmContentVo cmContentVo) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("f_cc_companyid", cmContentVo.getF_cco_orgId());
		return broadcastServiceBean.selectContentCountByOrgIdHY(map);
	}
	
	@RequestMapping("/selectCustomContentCount")
	@ResponseBody
	public List<CmReviewGroupVo> selectCustomContentCount(CmReviewGroupVo cmReviewGroupVo,int pageNo,int pageSize) {
		return broadcastServiceBean.selectCustomContentCount(cmReviewGroupVo,pageNo,pageSize);
	}
	
	@RequestMapping("/selectCustomContentCountList")
	@ResponseBody
	public List<CmContentVo> selectCustomContentCountList(CmReviewGroupVo cmReviewGroupVo,int pageNo,int pageSize) {
		return broadcastServiceBean.selectCustomContentCountList(cmReviewGroupVo,pageNo,pageSize);
	}
	
	@RequestMapping("/selectReviewGroupById")
	@ResponseBody
	public CmReviewGroupVo selectReviewGroupById(CmReviewGroupVo cmReviewGroupVo){
		return broadcastServiceBean.selectReviewGroupById(cmReviewGroupVo);
	}
	
	@RequestMapping("/selectCustomContentListCount")
	@ResponseBody
	public Object selectCustomContentListCount(CmReviewGroupVo cmReviewGroupVo) {
		Map<String, Object> map = new HashMap<String,Object>();
		int count = broadcastServiceBean.selectCustomContentListCount(cmReviewGroupVo);
		map.put("count", count);
		return map;
	}
}
